package wisp.gui;

import java.awt.Color;

import com.golden.gamedev.gui.TFloatPanel;
import com.golden.gamedev.gui.*;
import com.golden.gamedev.gui.toolkit.UIConstants;

//wisp
import wisp.dataObjects.*;
import wisp.game.PlayerSprite;

//JFC
import java.awt.Color;

public class ComradeWindow extends TFloatPanel{

	private TPanel[] comradeBox = new TPanel[12];
	public TLabel[] comradeName = new TLabel[12];
	private TPanel[] comradeOnlineBox = new TPanel[12];
	public Cbutton[] comradeCurseButton = new Cbutton[12];
	
	public int count;
	private int mx;
	private int my;
	
	public ComradeWindow(PlayerSprite p, GUImanager g){
		super("Comrades", true, true, 400,100,160,300);
		count = 0;
	}
	
	public void addComrade(String name, int status){
		
		if(count < 12)
		{
			comradeBox[count] = new TPanel(mx, my,160,22);
			
			comradeOnlineBox[count] = new TPanel(5,5,12,12);
			if(status == 0)//online sa vw
				comradeOnlineBox[count].UIResource().put("Background Color", Color.GREEN.brighter());
			else//online sa fb
				comradeOnlineBox[count].UIResource().put("Background Color", Color.GRAY.darker());
			
			comradeName[count] = new TLabel(name, 20, 5, 100, 15);
			comradeCurseButton[count] = new Cbutton("curse", 110, 5, 20, 12);
			
			comradeBox[count].add(comradeOnlineBox[count]);
			comradeBox[count].add(comradeName[count]);
			comradeBox[count].add(comradeCurseButton[count]);

			this.add(comradeBox[count]);
			
			count++;
			my +=22;
			
			System.out.println("[SYSTEM] friend added @ slot" + count);
			
		}else
			System.out.println("[SYSTEM] comrade list window full.");
	}
	
	public void setOnlineStatus(int pos, boolean vwOnline){
		if(pos < count){
			if(pos == 0)//online sa vw
				comradeOnlineBox[count].UIResource().put("Background Color", Color.GREEN.brighter());
			else//online sa fb
				comradeOnlineBox[count].UIResource().put("Background Color", Color.GRAY.darker());
		}
	}
	
	

}
